#include <iostream>
using namespace std;
//c++ 运算符, 除使用关键字operator外, 运算符与函数几乎没区别,
//return_type operator
//const Mystring& 单例
//可重新定义的单目运算符
/*
++ 递增
--
* 解决引用
-> 成员选择
! 逻辑非
& 取地址
~ 求反

 */
class Date
{
private:
    int Day; //range 1 - 30 (lets assume all months have 30 days)
    int Month;
    int Year;
public:
    //constructor that initiates the object to a day, month and year
    Date(int inputDay, int inputMonth, int inputYear):Day(inputDay),Month(inputMonth),Year(inputYear)
    {

    }
    //unary increment operator
    Date& operator++ ()
    {
        ++ Day;
        return *this; //this 对象内存地址 返回该对象
    }
    //unary decroment operator
    Date& operator--()
    {
        -- Day;
        return *this;
    }

    void DisplayDay(void)
    {
        cout << Year << "-" << Month << "-" << Day << endl;
    }
};

int main(int argc, char const *argv[])
{
    Date Holidy(6, 4, 2017);
    Holidy.DisplayDay();
    cout << "---------------------------" << endl;
    ++Holidy;
    Holidy.DisplayDay();
    return 0;
}
